package com.project_test.kun.travelling_1st.HomePage.category;

import org.json.JSONException;
import org.json.JSONObject;

import java.io.Serializable;

/**
 * Created by Administrator on 16-10-19.
 */
public class HomePCarListItem implements Serializable {

    private int id;
    private String picture;
    private String name;
    private String brand;
    private String model;
    private int price;
    private String username;
    private int guide;
    private int trans;

    public void pashJsonObject(JSONObject json) throws JSONException {
//        "id": "1000117",
        id = json.getInt("id");
//                "picture": "http://img3.handybest.com/Uploads/Car/920/16/06/5760b9d98e7c5.jpg!phone",
        picture = json.getString("picture");
//                "name": "美好的旅程，陪伴您的是奔驰SUV",
        name = json.getString("name");
//                "brand": "奔驰",
        brand = json.getString("brand");
//                "model": "SUV",
        model = json.getString("model");
//                "price": "1000.00",
        price = json.getInt("price");
//                "username": "恒远诚兴",
        username = json.getString("username");
//                "guide": "1",
        guide = json.optInt("guide");
//                "trans": "2"
        trans = json.optInt("trans");

    }

    public int getId() {
        return id;
    }

    public String getPicture() {
        return picture;
    }

    public String getName() {
        return name;
    }

    public String getBrand() {
        return brand;
    }

    public String getModel() {
        return model;
    }

    public int getPrice() {
        return price;
    }

    public String getUsername() {
        return username;
    }

    public int getGuide() {
        return guide;
    }

    public int getTrans() {
        return trans;
    }

    @Override
    public String toString() {
        return "HomePCarListItem{" +
                "id=" + id +
                ", picture='" + picture + '\'' +
                ", name='" + name + '\'' +
                ", brand='" + brand + '\'' +
                ", model='" + model + '\'' +
                ", price=" + price +
                ", username='" + username + '\'' +
                ", guide=" + guide +
                ", trans=" + trans +
                '}';
    }
}
